package com.mybatis.generate.generator;

import java.sql.SQLException;
import java.util.Map;

public class GeneratorMain {
	private static String rootPath;
	static {
		String classPath = GeneratorMain.class.getResource("/").getPath();
		rootPath = classPath.substring(0,classPath.indexOf("/target/classes/"));
	}
	/**
	 * 请直接修改以下代码调用不同的方法以执行相关生成任务
	 * @throws SQLException 
	 */
	
	public static void main(String[] args) throws Exception {
		GeneratorFacade g = new GeneratorFacade("com/mybatis/generate/config/generator_config.xml", rootPath);

		for (Map.Entry<String, Object> entry : g.tableMaps.entrySet()) {
			g.generateByTable(entry.getKey(), entry.getValue().toString());
		}
		
		//打开文件夹
//		Runtime.getRuntime().exec("cmd.exe /c start E:\\webapp-generator-output");
	}
}
